package com.example.app.service.impl;

import com.example.app.dao.OrganRepository;
import com.example.app.dao.mongdb.MongoOrganRepository;
import com.example.app.model.Organ;
import com.example.app.service.OrganService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by wangtao on 2018/2/3.
 */
@Service
public class OrganServiceImpl implements OrganService {

    private static final Logger logger = Logger.getLogger(OrganServiceImpl.class);

    @Autowired
    private OrganRepository organRepository;

    @Autowired
    private MongoOrganRepository mongoOrganRepository;

    @Override
    public Organ findOneFromCache(Long id) {
        return mongoOrganRepository.findOne(id);
    }

    @Override
    public List<Organ> findAllFromCache() {
        return mongoOrganRepository.findAll();
    }
}
